﻿<%@ Page Language="vb" AutoEventWireup="false" MasterPageFile="~/Master_Page/Master_IPORT.Master" CodeBehind="frm_TankandCargo.aspx.vb" Inherits="I_PORT.frm_TankandCargo"
    title="IRPC INTELLIGENT PORT SERVICE" %>
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
    
<%@ Register Src="~/Control/Confirm.ascx" TagName="Confirm1" TagPrefix="Confirm" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript" language="javascript">
    var _source;
    // keep track of the popup div
    var _popup;

    function showConfirm(customerid) {
        this._source = customerid;
        this._popup = $find('ModalPopupExtender3'); 
        this._popup.show();  
    }
       function okClick(){
        //  find the confirm ModalPopup and hide it
       this._popup.hide();
        __doPostBack(this._source.name,'');
       
    }
    
    function cancelClick(){
        //  find the confirm ModalPopup and hide it
        this._popup.hide();
    }
        function closeModal(type) {
           // document.getElementById('ctl00_contentplaceholder1_framePopup').src = 'about:blank';
           if(type == '1')
           {
           document.getElementById('ctl00_contentplaceholder1_framePopup').src = '../FormPopup/FrmTariff_Popup.aspx';
            var mpu = $find('ctl00_ContentPlaceHolder1_ModalPopupExtender1');
            mpu.hide();
            }
            else if(type == '2')
            {
            document.getElementById('ctl00_contentplaceholder1_framePopup2').src = '../FormPopup/estimate.aspx';
            var mpu = $find('ctl00_ContentPlaceHolder1_ModalPopupExtender2');
            mpu.hide();
            }
            else if (type == 'B')
            {
            document.getElementById('ctl00_contentplaceholder1_framePopup2').src = '../FormPopup/estimate.aspx';
            var mpu = $find('ctl00_ContentPlaceHolder1_ModalPopupExtender2');
            mpu.hide();
            document.getElementById('ctl00_contentplaceholder1_btnSaveBooking').click();
            }
            else if (type == 'Y')
            {
            document.getElementById('ctl00_contentplaceholder1_CancelPopup').src = '../FormPopup/Cancel_popup.aspx';
            var mpu = $find('ctl00_ContentPlaceHolder1_ModalPopupExtender6');
            mpu.hide();
            }
            else if (type == 'V')
            {
            document.getElementById('ctl00_contentplaceholder1_CancelPopup').src = '../FormPopup/Cancel_popup.aspx';
            var mpu = $find('ctl00_ContentPlaceHolder1_ModalPopupExtender6');
            mpu.hide();
            document.getElementById('ctl00_contentplaceholder1_btnSaveBookingCancel').click();
            }
            else if (type == 'M')
            {
            document.getElementById('ctl00_contentplaceholder1_CancelPopup').src = '../FormPopup/Cancel_popup.aspx';
            var mpu = $find('ctl00_ContentPlaceHolder1_ModalPopupExtender6');
            mpu.hide();
            document.getElementById('ctl00_contentplaceholder1_btnSaveBookingCancelMKT').click();
            }
            else
            {
            document.getElementById('ctl00_contentplaceholder1_framePopup').src = '../FormPopup/FrmTariff_Popup.aspx';
            var mpu = $find('ctl00_ContentPlaceHolder1_ModalPopupExtender1');
            mpu.hide();
            document.getElementById('ctl00_contentplaceholder1_btnLoad').click();
            }
           
        }
        function showTariff(type) {
        if (type == '1'){
             document.getElementById('ctl00_contentplaceholder1_framePopup').contentWindow.location.reload(true);
             }
             else{
             document.getElementById('ctl00_contentplaceholder1_framePopup2').contentWindow.location.reload(true);
             } 
        }
        function checkNumber(e)
{
var keycode;

if (window.event) keycode = window.event.keyCode; // ใช้ IE อ่ะ

else if (e) keycode = e.which; // ใช้ Firefox เน่าะ

 if (((keycode > 47) && (keycode < 58))||(keycode == 190)||(keycode == 46))
 {
 return true;
 }
return false;
}
</script>
<style type="text/css">
        .style2
        {
            height: 30px;
        }
        </style>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
 
   <ContentTemplate>
   
&nbsp;<table width="100%"  cellpadding="5" cellspacing="5">
  <tr>
  <td align="center">
           <table width="90%" cellpadding="0" cellspacing="0">
           <tr>
           <td align="right" class="style2"> PORT : </td>
           <td align="left" class="style2">
           <asp:RadioButtonList runat="server" ID="port" SkinID="raio" AutoPostBack="true">
            <asp:ListItem Value="B" Text="Bulk"></asp:ListItem>
            <asp:ListItem Value="L" Text="Liqued"></asp:ListItem>
           </asp:RadioButtonList>
           </td>
           </tr>
           <tr>
           <td align="right" class="style2">Customer : </td>
           <td align="left" class="style2"> <asp:TextBox ID="TextBox1" runat="server" Width="266px"></asp:TextBox>
             <asp:AutoCompleteExtender  runat="server" ID="AutoCompleteExtender1" BehaviorID="AutoCompleteEx2" CompletionInterval="50"
                     TargetControlID="TextBox1" ServicePath="../WebService/AutoComplete_IPORT.asmx" MinimumPrefixLength="3" 
                    ServiceMethod="GetCustomer" CompletionListCssClass="autocomplete_completionListElement"
                CompletionListItemCssClass="autocomplete_listItem"
                CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem" >
                <Animations>
                    <OnShow>
                        <Sequence>
                            <%-- Make the completion list transparent and then show it --%>
                            <OpacityAction Opacity="0" />
                            <HideAction Visible="true" />
                            
                            <%--Cache the original size of the completion list the first time
                                the animation is played and then set it to zero --%>
                            <ScriptAction Script="
                                // Cache the size and setup the initial size
                                var behavior = $find('AutoCompleteEx2');
                                if (!behavior._height) {
                                    var target = behavior.get_completionList();
                                    behavior._height = target.offsetHeight - 2;
                                    target.style.height = '0px';
                                }" />
                            
                            <%-- Expand from 0px to the appropriate size while fading in --%>
                            <Parallel Duration=".3">
                                <FadeIn />
                                <Length PropertyKey="height" StartValue="0" EndValueScript="$find('AutoCompleteEx2')._height" />
                            </Parallel>
                        </Sequence>
                    </OnShow>
                    <OnHide>
                        <%-- Collapse down to 0px and fade out --%>
                        <Parallel Duration=".3">
                            <FadeOut />
                            <Length PropertyKey="height" StartValueScript="$find('AutoCompleteEx2')._height" EndValue="0" />
                        </Parallel>
                    </OnHide>
                </Animations>
                 </asp:AutoCompleteExtender>
           </td>
           </tr>
           <tr>
           <td align="right" class="style2" >Service : </td>
           <td align="left" class="style2">
               <asp:Button ID="bntTariff" runat="server" Text="Select Service" Width="149px" 
                   CssClass="ButtonStyle"  OnClientClick="showTariff('1');" />
               </td>
           </tr>
           <tr>
           <td align="right" class="style2">&nbsp;</td>
           <td align="left" class="style2">
                <asp:UpdatePanel ID="updateTariff" runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                  <asp:GridView ID="gridTariff" runat="server" SkinID="gridblueNoPage" DataKeyNames="MAT_Default,KBETR,KONWA,MAT_Relation,MAT_ComputeM" AutoGenerateColumns="False">
                     <Columns>
                         <asp:TemplateField HeaderText="ชำระทันที" ItemStyle-Width="38px" Visible="false">
                             <ItemTemplate>
                                 <asp:CheckBox ID="chk_pay" runat="server" />
                             </ItemTemplate>
                             <ItemStyle HorizontalAlign="Center" />
                         </asp:TemplateField>
                         <asp:BoundField HeaderText="รหัส" DataField="MATERIAL" />
                         <asp:BoundField HeaderText="ชื่อ" DataField="Text_line" ItemStyle-HorizontalAlign="Center" />
                         <asp:BoundField HeaderText="จำนวน" DataField="Count" ItemStyle-HorizontalAlign="Center" />
                         <asp:TemplateField HeaderText="จำนวน" ItemStyle-Width="38px" Visible="false">
                             <ItemTemplate>
                                 <asp:TextBox ID="txtCount" runat="server" Text="<%# Bind('Count')%>" Width="35px" onkeypress="return checkNumber(this);" ></asp:TextBox>
                             </ItemTemplate>
                             <ItemStyle HorizontalAlign="Center" />
                         </asp:TemplateField>
                         <asp:BoundField HeaderText="หน่วย" DataField="Unit" ItemStyle-HorizontalAlign="Center" />
                         <asp:BoundField HeaderText="ราคา/หน่วย" DataField="KBETR" ItemStyle-HorizontalAlign="Center" />
                          <asp:TemplateField HeaderText="ราคา/หน่วย" ItemStyle-Width="38px" Visible="false">
                             <ItemTemplate>
                                 <asp:TextBox ID="txtSumKBETR" runat="server" Text="<%# Bind('KBETR')%>" Width="35px" onkeypress="return checkNumber(this);" ></asp:TextBox>
                             </ItemTemplate>
                             <ItemStyle HorizontalAlign="Center" />
                         </asp:TemplateField>
                         <asp:TemplateField HeaderText="ลบ" ItemStyle-Width="50px" ItemStyle-HorizontalAlign="Center" Visible="true">
                            <ItemTemplate>
                                 <asp:ImageButton ID="imgdelete" CommandName="cmddelete" CommandArgument="<%# Container.DataItemIndex %>" OnClientClick="showConfirm(this); return false;"  runat="server" ImageUrl="~/Image/cancel-24.gif" />
                             </ItemTemplate>
                         </asp:TemplateField>
                     </Columns>
                 </asp:GridView>
                </ContentTemplate>
                </asp:UpdatePanel>
               </td>
           </tr>
           <tr>
           <td align="right" class="style2">สถานที่ :</td>
           <td align="left" class="style2">
               <asp:DropDownList ID="ddlshore" runat="server" SkinID="ddl" ></asp:DropDownList>
               </td>
           </tr>
           
               <tr>
                   <td align="right" class="style2">
                       ตั้งแต่วันที่ :</td>
                   <td align="left" class="style2">
                       <asp:TextBox ID="txtDateStart" runat="server" Width="159px"></asp:TextBox><asp:ImageButton ID="ImgDateStart" runat="server" ImageUrl="~/Image/calendar.png" />
                       &nbsp;&nbsp;&nbsp;&nbsp;
                       ถึงวันที่ :&nbsp;&nbsp;
                       <asp:textbox ID="txtDateEnd" runat="server" Width="159px"></asp:textbox><asp:ImageButton ID="ImgDateEnd" runat="server" ImageUrl="~/Image/calendar.png" />

                 <asp:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtDateStart" Format="dd MMM yyyy" PopupButtonID="ImgDateStart"></asp:CalendarExtender>
                 <asp:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtDateEnd" Format="dd MMM yyyy" PopupButtonID="ImgDateEnd" ></asp:CalendarExtender>

                   </td>
               </tr>
               
               <tr>
                   <td align="right" class="style2">
                       ยอดรวม :</td>
                   <td align="left" class="style2">
                       <asp:TextBox ID="txtSum" runat="server" Width="159px"></asp:TextBox>
                   </td>
               </tr>
               
               <tr>
                   <td align="right" class="style2">
                       คงเหลือ :</td>
                   <td align="left" class="style2">
                       <asp:TextBox ID="txtTotal" runat="server" Width="154px"></asp:TextBox>
                   </td>
               </tr>
               <tr>
                    <td align="right" class="style2"> หมายเหตุ : </td>
                    <td align="left" class="style2">
                        <asp:TextBox TextMode="MultiLine" Width="250px" Height="60px" ID="Description" runat="server"></asp:TextBox>
                    </td>
                    </tr>
               <tr>
                   <td align="right">
                       &nbsp;</td>
                   <td align="left">
                       <asp:Button ID="BntSaveData" runat="server" Text="บันทึกข้อมูล" Width="106px" />
                       &nbsp;&nbsp;<asp:Button ID="BntPrint" runat="server" Text="พิมพ์ใบเสร็จชั่วคราว" 
                           Width="117px" />
                   </td>
               </tr>
           </tr>
           </table>
  </td>
  </tr></table>

     <asp:Button ID="btnLoad" runat="server" Text="Button" style="display:none" />
     <asp:Button ID="btnSaveBookingCancel" runat="server" Text="Button" style="display:none;" />
     <asp:Button ID="btnSaveBookingCancelMKT" runat="server" Text="Button" style="display:none;" />
     <asp:Button ID="btnTemp" runat="server" Text="Button" style="display:none" />
     <asp:Button ID="BtnTrigger" runat="server" Text="Button" style="display:none" />
     <asp:Button ID="btnSaveBooking" runat="server" Text="Button" style="display:none" />
     <asp:Button ID="btnTempCancel" runat="server" Text="Button" style="display:none;" />
        <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" BackgroundCssClass="Background"
     TargetControlID="bntTariff" PopupControlID="PopupAdd" >
    </asp:ModalPopupExtender>
        <asp:ModalPopupExtender ID="ModalPopupExtender2" runat="server" BackgroundCssClass="Background"
     TargetControlID="btnTemp" PopupControlID="PopupCompute" >
    </asp:ModalPopupExtender>
    <asp:ModalPopupExtender ID="ModalPopupExtender3" BehaviorID="ModalPopupExtender3" runat="server" 
                                    OkControlID="ctl00_contentplaceholder1_ConfirmDelete_btnOk" 
                                    OnOkScript="okClick();" 
                                    CancelControlID="ctl00_contentplaceholder1_ConfirmDelete_btnNo"     
                                    OnCancelScript="cancelClick();" 
                                     BackgroundCssClass="Background" DropShadow="false" 
                                      PopupControlID="PanelConfirm" TargetControlID="BtnTrigger" >
        </asp:ModalPopupExtender>
    <asp:ModalPopupExtender ID="ModalPopupExtender6" runat="server" BackgroundCssClass="Background"
     TargetControlID="btnTempCancel" PopupControlID="PanelCancel" >
    </asp:ModalPopupExtender>
      <asp:Panel ID="PopupAdd" runat="server" Style="display: none;">
        <table>
            <tr>
                <td>
                    <iframe runat="server" id="framePopup" class="Style-Iframe" marginheight="0px" marginwidth="0px" src="../FormPopup/FrmTariff_Popup.aspx">
                    </iframe>
                </td>
            </tr>
        </table>
    </asp:Panel>
        <asp:Panel ID="PopupCompute" runat="server" Style="display: none;">
        <table>
            <tr>
                <td>
                    <iframe runat="server" id="framePopup2" marginheight="0px"  class="Style-Iframe" marginwidth="0px" src="../FormPopup/estimate.aspx">
                    </iframe>
                </td>
            </tr>
        </table>
    </asp:Panel>
   <asp:Panel ID="PanelCancel" runat="server" Style="display: none;">
        <table>
            <tr>
                <td>
                    <iframe runat="server" id="CancelPopup" marginheight="0px"  class="Style-Iframe" marginwidth="0px" src="../FormPopup/Cancel_popup.aspx?Type=Manage">
                    </iframe>
                </td>
            </tr>
        </table>
    </asp:Panel>
        <asp:Panel ID="PanelConfirm" runat="server" style="display:none;">
            <Confirm:Confirm1 ID="ConfirmDelete" runat="server" ></Confirm:Confirm1>
        </asp:Panel>
          </ContentTemplate>
</asp:UpdatePanel>
<%--<script type="text/javascript"> 
   //SYNTAX: tabdropdown.init("menu_id", [integer OR "auto"])
   tabdropdown.init("colortab", 1)
</script>--%>
</asp:Content>
